package com.lanqiao.companymanage.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 棍棍
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description= "返回响应数据")
public class Result {
    @ApiModelProperty(value = "状态码,200成功,500失败,501未登录")
    private Integer code;
    @ApiModelProperty(value = "响应的提示信息")
    private String msg;
    @ApiModelProperty(value = "查询的数据")
    private Object data;

    public static Result success(Object data){
        return new Result(Constant.SUCCESS,"",data);
    }

    public static Result success(){
        return new Result(Constant.SUCCESS,"",null);
    }

    public static Result success(String msg,Object data){
        return new Result(Constant.SUCCESS,msg,data);
    }

    public static Result err(String msg){
        return new Result(Constant.ERR,msg,null);
    }

    public static Object NoLogin() {
        return new Result(Constant.NoLogin,"请先登录后再试",null);
    }
}
